package JFrame;

import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class LoginDemo {
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		JPanel panel = new JPanel();
		frame.add(panel);
		
		//panel布局设置
		panel.setLayout(new GridLayout(3, 1));
		
		//name_panel
		JPanel name_panel = new JPanel();
		JLabel name_label = new JLabel("用户名：");
		JTextField name_textfield = new JTextField(10);
		name_panel.add(name_label);
		name_panel.add(name_textfield);
		panel.add(name_panel);
		
		//psd_panel
		JPanel psd_panel = new JPanel();
		JLabel psd_label = new JLabel("密  码：");
		JTextField psd_textfield = new JTextField(10);
		psd_panel.add(psd_label);
		psd_panel.add(psd_textfield);
		panel.add(psd_panel);

		//button_panel
		JPanel button_panel = new JPanel();
		JButton login_button = new JButton("登录");
		JButton cancel_button = new JButton("取消");
		button_panel.add(login_button);
		button_panel.add(cancel_button);
		panel.add(button_panel);
		
		//JFrame属性设置
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(300, 150);
		frame.setTitle("BorderLayiut_Test");
		frame.setLocation(500, 400);
		frame.setResizable(false);
		frame.setVisible(true);
	}
}
